package persistencia.homes;

import java.util.List;

import persistencia.DBManager;
import artistas.ArtistaMusical;

import com.db4o.query.Predicate;

import espectaculos.Festival;

/**
 * TODO: description
 */
public class FestivalHome extends GenericHome {

    @SuppressWarnings("unchecked")
    public static List<Festival> listAll() {
        return (List<Festival>) GenericHome.listAll(Festival.class);
    }

    public static Festival get(final Festival f) {
        return (Festival) GenericHome.get(f);
    }
    
    @SuppressWarnings({ "unchecked", "serial" })
	static public List<Festival> festivalArtista(final ArtistaMusical artista) {
        return (List<Festival>) DBManager.getInstance().query(
        		new Predicate<Festival>(){
        			@Override
        			public boolean match(Festival f) {
        				return  f.getArtistas().contains(artista);
        			}
        		}
        );
    }
}
